<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="/struts-tags" prefix="s"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<base href="<%=basePath%>">

		<title>dept_list.jsp</title>

		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0">
		<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
		<meta http-equiv="description" content="This is my page">

		<link rel="stylesheet" type="text/css" href="./css/style.css">
		
		<script type="text/javascript">
		function test(){
		    var id;
			var c=document.getElementsByName("detail");
			var i=0;
			for(i=0;i<c.length;i++){
			   if(c[i].checked==true){
			    id=c[i].value;
			    break;
			   }
			}
			if(id==""||id==null){
			alert("请选择其中一个");
			}else{
			//alert(id);
			url="./dept/deptDetailAction?id="+id;
			location.href=url;
			}
		}
		function changeselectisnull1(){
			//alert("a");
			var nam=document.getElementById("nam");
			nam[0].selected="selected";
		}
		function changeselectisnull2(){
			//alert("b");	
			var man=document.getElementById("man");
			man[0].selected="selected";
		}
		</script>
		
		
	</head>
	
	<body>

		<div id="blue_button">
			<div id="blue_button_word">
				&nbsp;部门管理
			</div>
		</div>

		<div id="right_background">
			&nbsp;
			<br />
			<br />
			<br />
			<form action="./dept/queryDeptAction" method="post">
		<div style="margin-left:10%">
			部门经理：<select name="man" onchange="changeselectisnull1()" id="man">
			         <option value=""></option>
			         <s:iterator value="elist" var="elist">
			         <option  value="<s:property value="#elist.EName"/>"><s:property value="#elist.EName"/></option>
			         </s:iterator>
			         </select>
			部门名称: <select name="nam" onchange="changeselectisnull2()" id="nam">
			         <option value=""></option>  
			         <s:iterator value="ddlist" var="elist">
			         	<option  value="<s:property value="#elist.dname"/>"><s:property value="#elist.dname"/></option>
			         </s:iterator>
			         </select>
			<input type="submit" class="del" value="查询"/>
			<font color="orange">${msg3}</font>
			<br/>
			</div>
			<br/>
				<table cellspacing="1" class="tab_dept">

					<tr class="tab_header">
						<td valign="middle" align="center">
							部门名称
						</td>
						<td valign="middle" align="center">
							联系电话
						</td>
						<td valign="middle" align="center">
							负责人
						</td>
						<%-- 
			                <td valign="middle" align="center">
								部门状态
							</td>
						--%>
						<td valign="middle" align="center">
							详细
						</td>
					</tr>

					<s:iterator value="dlist" var="list">
						<tr class="row2" onMouseOver="this.className='row1'"
							onMouseOut="this.className='row2'">
							<td valign="middle" align="center">
								<s:property value="#list.dname" />
							</td>
							
							<td valign="middle" align="center">
								<s:property value="#list.DPhone" />
							</td>
							<td valign="middle" align="center">
								<s:property value="#list.comEmp.EName" />
							</td>
							<%-- 
								<td valign="middle" align="center">
									<s:property value="#list.DStatus" />
								</td>
							--%>
							<td valign="middle" align="center">
								<input type="radio"  id="detail" name="detail" value="<s:property value="#list.deptno" />"  />
							</td>
							
						</tr>
					</s:iterator>
				</table>
                </form>
			
				<input type="button" class="add" style="margin-top: 20px; margin-left: 810px;" value="详细信息"  onclick="test();"/>
				&nbsp; 
			<br/>
			<s:if test="%{xm==1}">
			<p class="paging" style="text-align: center">
			<s:if test="%{currentPage == 1}">
				&lt;&lt; 首页 &lt; 上一页
			</s:if>
			<s:else>
				<a href="./dept/deptAction?page=1"> &lt;&lt;首页</a>
				<a href="./dept/deptAction?page=${currentPage-1}">&lt; 上一页 </a>
			</s:else>
		
			<strong>第${currentPage}页/共${totalPages}页</strong>
			
			<s:if test="%{currentPage == totalPages}">
				下一页 &gt;
				末页 &gt;&gt;
			</s:if>
			<s:else>
				<a href="./dept/deptAction?page=${currentPage+1}"> 下一页 &gt;</a>
				<a href="./dept/deptAction?page=${totalPages}">末页 &gt;&gt;</a>
			</s:else>
		</p>
		</s:if>
		<s:else>
		
		</s:else>
</div>
	</body>
</html>
